fix(editor): expose and align configurable caret geometry - #2759
Open
pangxingzhong1983 wants to merge 2 commits into
Open
fix(editor): expose and align configurable caret geometry#2759pangxingzhong1983 wants to merge 2 commits into
pangxingzhong1983 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
The high-level editor did not expose the full cursor geometry contract. Internally, caret painting and getLocalRectForCaret also used different calculations. macOS followed Apple paint behavior but an iOS-only prototype branch, while inactive lines cached old geometry and the editor root dropped horizontal child offsets. This could place a thin caret inside the final glyph and make IME or reveal geometry disagree with the pixels on screen.
Compatibility
All new fields are optional. Existing cursor width still defaults to 2.0, and unset geometry continues to use Flutter platform defaults. copyWith keeps the existing null-means-preserve convention.
Validation
The regression matrix covers Android, Fuchsia, iOS, Linux, macOS, and Windows; DPR 1 and 2; Latin, CJK, empty, and multiline text; inactive-line style updates; explicit zero offset and radius; and centered max-content-width layouts with nonzero padding.